package com.hqyj.cloudTest.dao;


import com.hqyj.entity.Test.Country;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * personal demo
 **/

@Mapper
@Repository
public interface CountryDao {

    @Select("select*  from test_country where country_id=#{id}")
    @Results(id = "countryResult" ,value = {
        @Result(column = "country_id",property = "countryId"),
        @Result(
            column = "country_id",
            property = "cities",
            javaType = List.class,
            many = @Many(select =
                    "com.sfac.springBoot.module.test.dao.CityDao.getCitiesByCountryId")
        )
    })
    Country getCountryById(int id);
}
